home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Animation How-To
/
Animation How-to CD.iso
/
PLY
/
CHAPTER2
/
BOLITA
/
BOLITA3.PI
< prev
next >
Wrap
Text File
|
1994-01-01
|
6KB
|
230 lines
// BOLITA3.PI
// Bumping line o' balls, infinite procession, flapping down a tunnel
start_frame 0
end_frame 179
total_frames 180
outfile balls
include "\ply\colors.inc"
// Set up background color & lights
background Navyblue
define dim <0.7,0.7,0.7>
light dim,<10, 10, -20>
light dim,<-10, 10, -20>
light <0, 20, 0>
// Set up the camera
viewpoint {
from <12, 12,-22>
at <0.5, 5, 0>
up <0, 1, 0>
angle 50
resolution 320,200
aspect 1.43
}
define pi 3.14159
define rad pi / 180
define speed 10
define t frame*speed
define moving floor (frame/(360/speed)) + 1
define phz 30 * sin(t * rad)
define ang 270 + phz
// ball 1
if (phz > 0 && 1 > (5 - moving)) {
define x1 8 * cos(ang * rad) + 1 * 2 - 6
define y1 8 * sin(ang * rad) + 8
}
else {
define x1 1 * 2 - 6
define y1 0
}
if (phz < 0 && 1 < (moving + 1)) {
define x1 8 * cos(ang * rad) + 1 * 2 - 6
define y1 8 * sin(ang * rad) + 8
}
// ball 2
if (phz > 0 && 2 > (5 - moving)) {
define x2 8 * cos(ang * rad) + 2 * 2 - 6
define y2 8 * sin(ang * rad) + 8
}
else {
define x2 2 * 2 - 6
define y2 0
}
if (phz < 0 && 2 < (moving + 1)) {
define x2 8 * cos(ang * rad) + 2 * 2 - 6
define y2 8 * sin(ang * rad) + 8
}
// ball 3
if (phz > 0 && 3 > (5 - moving)) {
define x3 8 * cos(ang * rad) + 3 * 2 - 6
define y3 8 * sin(ang * rad) + 8
}
else {
define x3 3 * 2 - 6
define y3 0
}
if (phz < 0 && 3 < (moving + 1)) {
define x3 8 * cos(ang * rad) + 3 * 2 - 6
define y3 8 * sin(ang * rad) + 8
}
// ball 4
if (phz > 0 && 4 > (5 - moving)) {
define x4 8 * cos(ang * rad) + 4 * 2 - 6
define y4 8 * sin(ang * rad) + 8
}
else {
define x4 4 * 2 - 6
define y4 0
}
if (phz < 0 && 4 < (moving + 1)) {
define x4 8 * cos(ang * rad) + 4 * 2 - 6
define y4 8 * sin(ang * rad) + 8
}
// ball 5
if (phz > 0 && 5 > (5 - moving)) {
define x5 8 * cos(ang * rad) + 5 * 2 - 6
define y5 8 * sin(ang * rad) + 8
}
else {
define x5 5 * 2 - 6
define y5 0
}
if (phz < 0 && 5 < (moving + 1)) {
define x5 8 * cos(ang * rad) + 5 * 2 - 6
define y5 8 * sin(ang * rad) + 8
}
// make the mounts flap like a bird
define phz2 10 * COS(2*t * rad) + exp(1.6 * (1 + cos((2*t - 80) *
rad)))
define ang2 45 + phz2
define zm 8 * COS(ang2 * rad)
define ym 8 * SIN(ang2 * rad) + 2
define fy -4 * SIN(ang2 * rad) + 4
define z 0
define slateish
texture {
surface {
ambient SlateBlue, 0.2
diffuse SlateBlue, 0.6
specular white, 0.6
reflection white,0.5
microfacet Reitz 10
}
}
define real_dark <0.1,0.1,0.1>
define onyx texture { metallic { color real_dark } }
define blue_ripple
texture {
noise surface {
color navyblue
normal 2
frequency 1
phase -2*pi*t/360
bump_scale 2
ambient 0.2
diffuse 0.4
specular yellow, 0.5
reflection 0.25
microfacet Reitz 10
}
}
define light_blue_ripple
texture {
noise surface {
color navyblue
normal 1
frequency 1
phase -2*pi*t/360
bump_scale 0.2
ambient 0.2
diffuse 0.4
specular yellow, 0.5
reflection 0.25
microfacet Reitz 10
}
}
// the flapping clacking contraption
define bolita
object {
object { sphere <x1,y1+fy,z>,1 slateish }
+ object { sphere <x2,y2+fy,z>,1 slateish }
+ object { sphere <x3,y3+fy,z>,1 slateish }
+ object { sphere <x4,y4+fy,z>,1 slateish }
+ object { sphere <x5,y5+fy,z>,1 slateish }
// the strings
+ object {cylinder <x1,y1+1+fy,z>,<1*2-6,ym,-zm>,0.05 shiny_orange }
+ object {cylinder <x2,y2+1+fy,z>,<2*2-6,ym,-zm>,0.05 shiny_orange }
+ object {cylinder <x3,y3+1+fy,z>,<3*2-6,ym,-zm>,0.05 shiny_orange }
+ object {cylinder <x4,y4+1+fy,z>,<4*2-6,ym,-zm>,0.05 shiny_orange }
+ object {cylinder <x5,y5+1+fy,z>,<5*2-6,ym,-zm>,0.05 shiny_orange }
+ object { cylinder <x1,y1+1+fy,z>,<1*2-6,ym,zm>,0.05 shiny_orange }
+ object { cylinder <x2,y2+1+fy,z>,<2*2-6,ym,zm>,0.05 shiny_orange }
+ object { cylinder <x3,y3+1+fy,z>,<3*2-6,ym,zm>,0.05 shiny_orange }
+ object { cylinder <x4,y4+1+fy,z>,<4*2-6,ym,zm>,0.05 shiny_orange }
+ object { cylinder <x5,y5+1+fy,z>,<5*2-6,ym,zm>,0.05 shiny_orange }
// the mounts
+ object { box <-6,ym-0.1,-zm-0.5>,<6,ym+0.5,-zm+0.5> onyx }
+ object { box <-6,ym-0.1, zm-0.5>,<6,ym+0.5, zm+0.5> onyx }
}
define copies fmod(frame,36)
bolita { translate <-66+copies,0,0> }
bolita { translate <-30+copies,0,0> }
bolita { translate < 6+copies,0,0> }
// make watery walls
object {
object {cylinder <-100,0,0>,<100,0,0>,16}
& object {box <-101,-8,-20>,<101,20,20>}
rotate <125,0,0>
translate <0,4,5>
blue_ripple
}
// reflecting pool
object {
polygon 4,<-100,-4,-10>,<-100,-4,10>,<100,-4,10>,<100,-4,-10>
onyx
}